<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>购物车</title>
<link href="./css/common.css" rel="stylesheet" />
<link href="./css/common-head-footer.css" rel="stylesheet" />
<link href="./css/shop-car.css" rel="stylesheet" />
<script type="text/javascript" src="./js/util.js"></script>
<script type="text/javascript">
function selectAll(obj){
	var pitems=document.getElementsByName("pitem");
	for(var i=0;i<pitems.length;i++){
		pitems[i].checked=obj.checked;
	}
}

window.onload=function(){
	initListener();
};
function initListener(){
	var pitems=document.getElementsByName("pitem");
	for(var i=0;i<pitems.length;i++){
		var curId=pitems[i].value;
		var countItem=document.getElementById("count_"+curId);
		countItem.curId=curId;
		countItem.onkeyup=function(){
			var price=document.getElementById("price_"+this.curId).innerHTML.float();
			var xiaojiContainer=document.getElementById("xiaoji_"+this.curId);
			this.value=this.value.int();
			xiaojiContainer.innerHTML=price*this.value;
			calcAllPrice();
		};
	}
}
/**
 * 计算支付总额
 */
function calcAllPrice(){
	var totalPrice=0;
	var pitems=document.getElementsByName("pitem");
	for(var i=0;i<pitems.length;i++){
		var xiaoji=document.getElementById("xiaoji_"+pitems[i].value).innerHTML.float();
		totalPrice+=xiaoji;
	}
	document.getElementById("total_price").innerHTML=totalPrice;
}
</script>
</head>
<body>
<jsp:include page="./sub-blocks/header-block.jsp"></jsp:include>
<div class="shop-car-panel">
	<div class="location-bar"  onselectstart="return false;">
		<div class="point-tip">购物车</div>
		<div class="arr-icon"></div>
		<div class="point-tip">购物车预览</div>
		<div class="arr-icon"></div>
		<div class="point-tip">填写订单</div>
		<div class="arr-icon"></div>
		<div class="point-tip">预览订单</div>
		<div class="arr-icon"></div>
		<div class="point-tip-on">完成订单</div>
	</div>
	<div class="product-list-container">
		订单已经生成，并发送，订单号：BX-3293434-H545454248545，请到后台管理订单！
		<div style="margin: 20px;text-align: center;">
			<input type="button" value="关闭页面" onclick="window.close()" />
		</div>
	</div>
</div>
<jsp:include page="./sub-blocks/footer-block.jsp"></jsp:include>
</body>
</html>